﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sector7.Restaurant.APs.ForeStation.Events;
using Sector7.Restaurant.Modules.SYST.Windows;
using Sector7.Restaurant.APs.ForeStation.Enums;
using Sector7.Restaurant.Modules.REST.Windows;
using Sector7.Restaurant.Modules.BIZZ.Windows;
using Sector7.Restaurant.Modules.STAT.Windows;

namespace Sector7.Restaurant.APs.ForeStation.Controls
{
    /// <summary>
    /// MainFrame.xaml 的交互逻辑
    /// </summary>
    public partial class MainFrame : UserControl
    {
        public MainFrame()
        {
            InitializeComponent();
        }

        private void LoadModule(MenuItemType itemType)
        {
            grdDesk.Children.Clear();
            
            UserControl module = null;
            switch (itemType)
            {
                case MenuItemType.Cashiers:
                    module = new CashiersWindow();
                    break;
                case MenuItemType.StockSummary:
                    module = new StockSummaryWindow();
                    break;

                case MenuItemType.CompanyInformation:
                    module = new CompanyInformationWindow();
                    break;
                case MenuItemType.EmployeeSummary:
                    module = new EmployeeSummaryWindow();
                    break;
                case MenuItemType.MenuSummary:
                    module = new MenuItemSummaryWindow();
                    break;
                case MenuItemType.TableSummary:
                    module = new TableSummaryWindow();
                    break;

                case MenuItemType.ChargeSummary:
                    module = new ChargeSummaryWindow();
                    break;

                case MenuItemType.MetaDataSummary:
                    module = new MetaDataSummaryWindow();
                    break;

                default:
                    module = new UserControl();
                    break;
            }

            grdDesk.Children.Add(module);
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            MetaDataSummaryWindow metadataSummary = new MetaDataSummaryWindow();
            grdDesk.Children.Clear();
            grdDesk.Children.Add(metadataSummary);
        }

        private void functionalStrip1_FunctionClick(object sender, FunctionClickEventArgs e)
        {
            menuStrip1.LoadFunctionItems(e.SubFunctions);
        }

        private void menuStrip1_MenuClick(object sender, MenuClickEventArgs e)
        {
            LoadModule(e.ItemType);
        }
    }
}
